import path from 'path';
import { merge as mergeAny } from 'merge-anything';

import { fnFileProtocolPath, fnImport } from '../utils/index.js';
import { systemConfig } from '../system.js';

let configPath = fnFileProtocolPath(path.resolve(systemConfig.appDir, 'config', 'role.js'));
let importConfig = await fnImport(configPath, []);

// 角色初始化配置
const roleConfig = mergeAny(
    [
        {
            code: 'visitor',
            name: '游客',
            describe: '具备有限的权限和有限的查看内容',
            is_system: 1
        },
        {
            code: 'user',
            name: '用户',
            describe: '用户权限和对于的内容查看',
            is_system: 1
        },
        {
            code: 'admin',
            name: '管理',
            describe: '管理权限、除开发相关权限之外的权限等',
            is_system: 1
        },
        {
            code: 'super',
            name: '超级管理',
            describe: '超级管理权限、除开发相关权限之外的权限等',
            is_system: 1
        }
    ],
    importConfig.roleConfig
);

export { roleConfig };
